\footnotesize{
\begin{verbatim}
create table player {  id int primary key  };

create table board {
  int x,
  int y,
  int id,
  primary key x,y;
  foreign key(id) references player(id);
 };

create view nowPlaying(id) as
  select p.id
  from player p
  where exists (select b.id from board b where b.id=p.id);

create view checked(id) as
  select p.id
  from player p
  where exists (select n.id from nowPlaying n where n.id = p.id) and
        not exists (select b1.id from board b1
                    where b1.id = p.id and 
                          not exists (select b2.id from board b2
                                      where (b2.x - b1.x) * (b2.y-b1.y)=0
                                            and (b1.id <> b2.id)));
\end{verbatim}
}